import * as echart from 'echarts';
const color = ['#65daff', '#fff'];
export const seriesOptions = {
  bar: {
    barwidth: 15,
    itemStyle: {
      borderRadius: [5, 5, 0, 0],
      // color: new echart.graphic.LinerGradient(0, 0, 1, 1, [
      //   { offset: 0, color: '#ff5b01' },
      //   { offset: 0.5, color: '#ff8b2a' },
      //   { offset: 1, color: '#ffba52' },
      // ]),
      color: {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 1,
        y2: 1,
        colorStops: [
          { offset: 0, color: '#ff5b01' },
          { offset: 0.7, color: '#ff8b2a' },
          { offset: 1, color: '#ffba52' },
        ],
        globalCoord: false, // 缺省为 false
      },
    },
  },
  line: { symbolSize: 8 },
  pie: {
    radius: ['40%', '90%'],
    avidLabelOverlap: false,
    itemStyle: {
      borderRadius: 10,
      borderColor: '#fff',
      borderWidth: 2,
    },
    label: {
      show: false,
      position: 'center',
    },
    labelLine: { show: false },
  },
};

export const BAR_LINE_DEFAULT_OPTION = {
  tooltip: {
    trigger: 'axis',
  },
  color,
  grid: {
    left: 65,
    right: 20,
    top: 10,
    bottom: 40,
  },
  textStyle: {
    color: '#999',
  },
  xAxis: {
    axisTick: { show: false },
    axisLine: {
      lineStyle: {
        color: '#d9d9d9',
      },
    },
  },
  yAxis: {
    xisLine: {
      lineStyle: {
        color: '#d9d9d9',
      },
    },
  },
};

export const PIE_DEFAULT_OPTION = {
  center: ['30%', '50%'],
  color,
  tooltip: {
    trigger: 'item',
    formatter: '{b}: {a} ({d}%)',
  },
  legend: {
    type: 'scrdl',
    oricnt: 'vertical',
    right: 10,
    top: 40,
    bottom: 40,
  },
};
